home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1998 Special / special1988a.d64 / memo diary (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  4KB  |  267 lines

  1. 90 f=(1=1)
  2. 100 gosub 2250
  3. 110 data jan,feb,mar,apr,may,jun
  4. 120 data jul,aug,sep,oct,nov,dec
  5. 130 data sunday,monday,tuesday,wednesday
  6. 140 data thursday,friday,saturday
  7. 150 dim m$(12),w$(6),l$(100)
  8. 160 for j=1 to 12
  9. 170 read m$(j)
  10. 180 next j
  11. 190 for j=0 to 6
  12. 200 read w$(j)
  13. 210 next j
  14. 220 print "event calendar"
  15. 230 if f=0 then 260
  16. 240 c=1
  17. 250 gosub 3010
  18. 255 if e=0 then 260
  19. 256 f=0
  20. 260 print "today's date:"
  21. 270 y8=y9
  22. 280 gosub 1670
  23. 290 m8=m
  24. 300 d8=d
  25. 310 if m8>=m9 then 330
  26. 320 y8=y9+1
  27. 330 if m8<>m9 or d8>=d9 then 350
  28. 340 y8=y9+1
  29. 350 if y8<=y9 then 370
  30. 360 print "happy new year"
  31. 370 if f then 400
  32. 380 print "year";
  33. 390 input y8
  34. 400 d9$=right$(str$(100+m9),2)+"/"
  35. 410 d9$=d9$+right$(str$(100+d9),2)
  36. 420 if f then 440
  37. 430 d9$=d8$
  38. 440 f=(1=1)
  39. 450 gosub 1960
  40. 460 print "past events: ";
  41. 470 if l0>=0 then 500
  42. 480 print "none"
  43. 490 goto 650
  44. 500 print l0+1
  45. 510 gosub 4010
  46. 520 f9=-1
  47. 530 for j=0 to l0
  48. 540 if mid$(l$(j),6,1)="/" then 570
  49. 550 l$(l9)=l$(j)
  50. 560 l9=l9+1
  51. 570 next j
  52. 580 l8=l0+1
  53. 590 for j=l8 to l9-1
  54. 600 l$(j-l8)=l$(j)
  55. 610 next j
  56. 620 l9=l9-l8
  57. 630 l8=0
  58. 640 l=l9
  59. 650 f=0
  60. 660 f9=0
  61. 670 d9$=d8$
  62. 680 l=l9-l8
  63. 690 if l<>0 then 710
  64. 700 print "no future events"
  65. 710 if l=0 then 730
  66. 720 print l;" future events"
  67. 730 print
  68. 740 print "1. see future events"
  69. 750 print "2. add new event"
  70. 760 print "3. cancel event"
  71. 770 print "4. search for event"
  72. 780 print "5. quit"
  73. 790 print
  74. 800 print "...your choice (1-5)";
  75. 810 input a
  76. 820 print
  77. 830 on a goto 850,940,1210,1450,1570
  78. 840 goto 730
  79. 850 print "ahead to date:"
  80. 860 gosub 1670
  81. 870 gosub 1960
  82. 880 if l0<>-1 then 910
  83. 890 print "no events"
  84. 900 goto 920
  85. 910 gosub 4010
  86. 920 print l9-l0-1;" other future events"
  87. 930 goto 730
  88. 940 print "annual or one-time (a/o)"
  89. 950 input p$
  90. 960 a=0
  91. 970 p$=left$(p$,1)
  92. 980 if p$="o" then 1010
  93. 990 a=1
  94. 1000 if p$<>"a" then 730
  95. 1010 gosub 1670
  96. 1020 y$="/"+right$(str$(101+y8),2)
  97. 1030 if d8$<=d9$ then 1050
  98. 1040 y$="/"+right$(str$(100+y8),2)
  99. 1050 if a<>1 then 1070
  100. 1060 y$=""
  101. 1070 gosub 1960
  102. 1080 if l9-1<l0+1 then 1120
  103. 1090 for j=l9-1 to l0+1 step -1
  104. 1100 l$(j+1)=l$(j)
  105. 1110 next j
  106. 1120 print "detail";
  107. 1130 input ll$
  108. 1140 d8$=d8$+y$
  109. 1150 d8$=d8$+" "
  110. 1160 l$(l0+1)=d8$+ll$
  111. 1170 l9=l9+1
  112. 1180 l=l9
  113. 1190 f9=-1
  114. 1200 goto 680
  115. 1210 print "change which date:"
  116. 1220 gosub 1670
  117. 1230 l0=-1
  118. 1240 for j=l8 to l9-1
  119. 1250 if d8$<>left$(l$(j),5) then 1300
  120. 1260 l1=j
  121. 1270 if l0<>-1 then 1290
  122. 1280 l0=j
  123. 1290 print j;": ";l$(j)
  124. 1300 next j
  125. 1310 if l0<>-1 then 1340
  126. 1320 print "no events"
  127. 1330 goto 730
  128. 1340 print
  129. 1350 print " delete which event above";
  130. 1360 input a
  131. 1370 if a<l0 or a>l1 then 730
  132. 1380 for j=a to l9-1
  133. 1390 l$(j)=l$(j+1)
  134. 1400 next j
  135. 1410 l9=l9-1
  136. 1420 f9=-1
  137. 1430 print " ... deleted"
  138. 1440 goto 680
  139. 1450 print "search for";
  140. 1460 input p$
  141. 1470 p=len(p$)
  142. 1480 for j=0 to l9-1
  143. 1490 a=7
  144. 1500 if mid$(l$(j),6,1)<>"/" then 1520
  145. 1510 a=10
  146. 1520 if a+p-1>len(l$(j)) or p$<>mid$(l$(j),a,p) then 1540
  147. 1530 print l$(j)
  148. 1540 next j
  149. 1550 print "    end of search"
  150. 1560 goto 730
  151. 1570 if f9<>0 then 1590
  152. 1575 ifothenclose15
  153. 1580 end
  154. 1590 print "ready to write new events file (y/n)"
  155. 1600 input p$
  156. 1610 if left$(p$,1)="y" then 1630
  157. 1620 stop
  158. 1630 d9$=d9$+"/"
  159. 1640 d9$=d9$+right$(str$(y8+100),2)
  160. 1650 c=2
  161. 1660 goto 3010
  162. 1670 m=0
  163. 1680 print "month";
  164. 1690 input mm$
  165. 1700 m=val(mm$)
  166. 1710 mm$=left$(mm$+"xx",3)
  167. 1720 if m=0 then 1760
  168. 1730 if m<1 or m>12 then 1670
  169. 1740 print m$(m)
  170. 1750 goto 1810
  171. 1760 for j=1 to 12
  172. 1770 if mm$<>m$(j) then 1790
  173. 1780 m=j
  174. 1790 next j
  175. 1800 if m<1 or m>12 then 1670
  176. 1810 print "day";
  177. 1820 input d
  178. 1830 if d<1 or d>31 then 1670
  179. 1840 d8$=right$(str$(100+m),2)+"/"
  180. 1850 d8$=d8$+right$(str$(100+d),2)
  181. 1860 y=y8
  182. 1870 if d8$>d9$ then 1890
  183. 1880 y=y8+1
  184. 1890 gosub 2150
  185. 1900 if len(ll$)<=0 then 1920
  186. 1910 print "(";w$(w);")"
  187. 1920 return
  188. 1930 c=1
  189. 1940 gosub 3010
  190. 1950 return
  191. 1960 ll$=chr$(255)
  192. 1970 l0=-1
  193. 1980 if l<>0 then 2000
  194. 1990 return
  195. 2000 v$=d8$+ll$
  196. 2010 ww$=d9$
  197. 2020 if f<>0 then 2040
  198. 2030 ww$=d9$+ll$
  199. 2040 f1=(ww$>=v$)
  200. 2050 for j=l8 to l9-1
  201. 2060 f2=(l$(j)>ww$)
  202. 2070 f3=(v$>l$(j))
  203. 2080 f0=f2 and f3
  204. 2090 if f1=0 then 2110
  205. 2100 f0=f2 or f3
  206. 2110 if f0=0 then 2130
  207. 2120 l0=j
  208. 2130 next j
  209. 2140 return
  210. 2150 if y>=85 then 2170
  211. 2160 y=y+100
  212. 2170 m1=m+1
  213. 2180 m2=int(1/m1+.7)
  214. 2190 m3=y-m2
  215. 2200 m4=m1+12*m2
  216. 2210 n=int(m4*30.6001)+int(m3*365.25)+d
  217. 2220 m6=int(n/7)
  218. 2230 w=n-7*m6
  219. 2240 return
  220. 2250 print chr$(147)chr$(5)
  221. 2260 return
  222. 3000 rem input/output routine
  223. 3010 f$="events"
  224. 3020 print"disk or cassette (d/c)?"
  225. 3030 geta$:if((a$<>"c")and(a$<>"d"))ora$=""then3030
  226. 3040 ifa$="d"then3060
  227. 3050 d1=0:g$="":goto3070
  228. 3060 f$="@0:"+f$:d1=1
  229. 3070 ifc=2then3160
  230. 3080 ifd1=1theng$=",s,r"
  231. 3090 open1,1+7*d1,8*d1,f$+g$:gosub3220:ifethenclose1:goto3150
  232. 3100 input#1,ll$:if len(ll$)<>8 then print ll$;"?":goto 3140
  233. 3110 m=val(left$(ll$,2)):d=val(mid$(ll$,4,2)):y0=val(mid$(ll$,7,2))
  234. 3120 m9=m:d9=d:y9=y0:l=0:print "last access: ";ll$
  235. 3130 input#1,l$(l):l=l+1:if st=0 then 3130
  236. 3140 close1:gosub3220
  237. 3150 l8=0:l9=l:return
  238. 3160 ifd1=1theng$=",s,w"
  239. 3170 open1,1+7*d1,1+7*d1,f$+g$:gosub3220:ifethenclose1:close15:end
  240. 3180 print#1,d9$;chr$(13);
  241. 3190 forj=0tol9-1:print#1,l$(j);chr$(13);:nextj
  242. 3200 gosub3220:close1:gosub3220:ifothenclose15
  243. 3210 end
  244. 3220 ifd1=0thenreturn
  245. 3230 ifo=0thenopen15,8,15:o=1
  246. 3240 input#15,e,b$:ifethenprintb$:close15:o=0
  247. 3250 return
  248. 4000 rem print routine
  249. 4010 d$="":p=3
  250. 4020 input "want events on printer (y/n)";p$
  251. 4030 if left$(p$,1)<>"y" then 4050
  252. 4040 p=4
  253. 4050 open 3,p
  254. 4060 for j=l8 to l0
  255. 4070 if d$=left$(l$(j),5) then 4150
  256. 4080 d$=left$(l$(j),5)
  257. 4090 m=val(left$(d$,2))
  258. 4100 d=val(mid$(d$,4,2))
  259. 4110 y=y8:if d$<=d9$ then y=y8+1
  260. 4120 gosub 2150
  261. 4130 print#3,w$(w);" ";
  262. 4140 print#3,m$(m);d
  263. 4150 print#3,"   ";mid$(l$(j),6)
  264. 4160 next j
  265. 4170 close 3
  266. 4180 return
  267.